package xin.zhiyin.控制.front;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import xin.zhiyin.实体.书类目Entity;
import xin.zhiyin.服务.书.书Service;
import xin.zhiyin.服务.书.书类目Service;

import java.util.List;

@Controller
@RequestMapping(path = "/")
public class 首页Controller {
    @Autowired
    private 书类目Service 书类目Service;
    @Autowired
    private 书Service 书Service;
    @GetMapping(path = "")
    public String 取首页(Model model)
    {
        List<书类目Entity> CategoryList = 书类目Service.获取所有书类目();
        model.addAttribute("bookCategoryList",CategoryList);
        model.addAttribute("bookList",书Service.获取所有书());

        return "front/index/index";//
    }
}
